package com.swt.gap.dao;

import com.github.pagehelper.Page;
import com.swt.gap.model.entity.SysUser;
import com.swt.gap.model.vo.UserInfoVO;
import com.swt.gap.model.vo.UserVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface SysUserMapper {

//    int insert(SysUser record);

    int insertSelective(SysUser record);

    SysUser selectByPrimaryKey(Integer userId);

    int updateByPrimaryKeySelective(SysUser record);

    //在未删除的用户中通过用户名查询一个用户
    SysUser selectOneByName(String userName);

    int deleteUser(Integer userId);

    //根据用户id获取用户信息
    UserInfoVO selectUserInfo(Integer userId);

    Page<UserInfoVO> selectUserListByKey(@Param("key") String key, @Param("roleId") Integer roleId);

    Page<UserInfoVO> listUser(@Param("keyword") String keyword,
                              @Param("roleIds") List<Integer> roleIds,
                              @Param("departmentId") Integer departmentId);

    //重置密码
    int updatePwd(@Param("userId") Integer userId, @Param("password") String password);

    //通过用户名查询一个用户id
    Integer selectIdByName(String userName);

    List<UserVO> selectIdsAndNames();

    Page<UserInfoVO> selectByDepartmentId(@Param("keyword") String keyword, @Param("departmentId")Integer departmentId);

    Page<UserInfoVO> selectByGroupId(@Param("keyword") String keyword, @Param("groupId")Integer groupId);

//    List<UserInfoVO> selectByGroupId(Integer groupId);
}